package com.tourlaid.mamagerment.action

import com.tourlaid.mamagerment.ao.pc.CommonAo
import com.tourlaid.mamagerment.entity.ResponseData
import com.tourlaid.mamagerment.vo.LinkageVo
import com.tourlaid.mamagerment.vo.SelectVo
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * Created by xiaoyongge on 2017/7/20.
 */
@RestController
@RequestMapping("/tld/pub/common")
class CommonAction {

    @Autowired
    val commonAo: CommonAo? = null

    @RequestMapping("/getGoodsSelectVo.json")
    fun getGoodsSelectVo(): ResponseData<List<SelectVo>> {
        val voList = commonAo!!.getGoodsSelectVo();
        return ResponseData(voList)
    }

    @RequestMapping("/getSupplierSelectVo.json")
    fun getSupplierSelectVo(): ResponseData<List<SelectVo>> {
        val voList = commonAo!!.getSupplierSelectVo();
        return ResponseData(voList)
    }

    @RequestMapping("/getShopSelectVo.json")
    fun getShopSelectVo(): ResponseData<List<SelectVo>> {
        val voList = commonAo!!.getShopSelectVo();
        return ResponseData(voList)
    }

    @RequestMapping("/getStockInSelectVo.json")
    fun getStockInSelectVo(goodsId: Long): ResponseData<List<SelectVo>> {
        val voList = commonAo!!.getStockInSelectVo(goodsId);
        return ResponseData(voList)
    }

    @RequestMapping("/getStoreTypeLinkageVo.json")
    fun getStoreTypeLinkageVo(): ResponseData<List<LinkageVo>> {
        val voList = commonAo!!.getStoreTypeLinkageVo();
        return ResponseData(voList)
    }

    @RequestMapping("/getStoreTypeLinkageVo2.json")
    fun getStoreTypeLinkageVo2(): ResponseData<List<LinkageVo>> {
        val voList = commonAo!!.getStoreTypeLinkageVo2();
        return ResponseData(voList)
    }

    @RequestMapping("/getAreaList.json")
    fun getAreaList(cityName: String): ResponseData<MutableList<LinkageVo>> {
        val voList = commonAo!!.getAreaList(cityName);
        return ResponseData(voList)
    }

    @RequestMapping("/getAreaLinkageVo.json")
    fun getAreaLinkageVo(parentName: String): ResponseData<List<LinkageVo>> {
        val voList = commonAo!!.getAreaLinkageVo(parentName);
        return ResponseData(voList)
    }
}